package lab02.test21;
import java.io.IOException;
import java.util.Scanner;
public class Test21 {
    public static void main(String[] args) throws IOException {
        System.out.println("请输入一个字符串：");
        Scanner sc = new Scanner(System.in);
        String string = sc.nextLine();
        System.out.println("请输入要计数的字符：");
        char ch = (char)System.in.read();
        int count = 0;
        for (int i = 0;i < string.length();i++){
            char tmp = string.charAt(i);
            if (ch == tmp){
                count = count + 1;
            }
        }
        System.out.println("频率：" + count);
    }
}
